#include <iostream>
using namespace std;
int main()
{
	int len,sum;
	cin>>len;
	int *p=new int[len];
	for(int i=0;i<len;i++){
		cin>>p[i];
	}
	cin>>sum;
	for(int i=0;i<len;i++){
		for(int j=1;j+i<len;j++){
			if(p[i]+p[i+j]==sum){
				cout<<'['<<i<<','<<i+j<<']';
				delete [] p;
				return 0;
			}
		}
	}
}
